Skip to content

feat(hooks): delete SessionEnd captureMemory session_checkpoint write (03-R1/06-M1)#80

Merged
itlackey merged 2 commits into
release/0.9.0from
improve/shutdown-capturememory-write
Jul 5, 2026
Merged

feat(hooks): delete SessionEnd captureMemory session_checkpoint write (03-R1/06-M1)#80
itlackey merged 2 commits into
release/0.9.0from
improve/shutdown-capturememory-write

Conversation

@itlackey

@itlackey itlackey commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Meta-review minting-shutdown, akm-plugin half. Deletes the below-every-gate SessionEnd captureMemory() write (akm remember --force, akm_memory_kind: session_checkpoint) that flooded the stash with write-only telemetry on every Stop/SubagentStop/PreCompact.

Deleted: captureMemory() + 3 call sites, the capture-memory CLI subcommand, helpers used only by it, and the Stop/SubagentStop/PreCompact hook registrations (whose only command was capture-memory …). akm index on session-end survives — relocated into sessionEnd() under the same gates.

Preserved (verified by code-review): the memory-CANDIDATE → /akm-memory-promote pipeline, the akm extract SessionEnd path, and tagRecalledContent (injection-hardening banner — not captureMemory-specific).

Evals: the tier-2 memory metric replayed through the now-deleted capture-memory, so it's removed and the baseline regenerated (baseline:update, 5 metrics). Latency drift is harmless (opt-in, not gated by default).

Gate: bun test tests/ 319/0; tier2/runner.ts --baseline exit 0.

This branch also carries the unmerged batch-1 akm-plugin commit (48f9345 — SubagentStart injection hardening + recalled-content provenance tagging) which never got its own PR.

Follow-ups (out of scope, tracked): opencode/index.ts has its own parallel session_checkpoint write (sibling plugin); the akm-side recombine isSessionCaptureMemoryName filter deletion is DEFERRED (load-bearing); and the owner steps remain — remove the live update-stashes crontab entry (paired akm PR #709) + bun run build/reinstall (~beta.59).

🤖 Generated with Claude Code

https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv

itlackey and others added 2 commits July 4, 2026 17:19
…ntent

Plugin-side companions to the akm review-07 hardening.

07 P1-B (item 20): the SubagentStart hook injected the raw
`akm workflow list --active` JSON into subagent context — including
workflowTitle (verbatim from workflow frontmatter) and params (arbitrary
user input), both attacker-influenceable. summarizeActiveWorkflows() now
emits only run id + ref + status + current step, dropping title/params.

07 hardening (item 21): recalled/curated stash content is written to a file
the agent reads (both the UserPromptSubmit prompt-recall and SessionStart
paths). tagRecalledContent() prepends a provenance banner framing the block
as reference DATA, not trusted instructions — the interim mitigation for the
captureMemory injection surface that does NOT delete the write (that deletion
stays deferred behind the minting-shutdown measurement gate).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv
…rite (03-R1/06-M1)

The Claude plugin's SessionEnd `captureMemory()` path wrote a `session_checkpoint`
memory via `akm remember … --force` on every Stop/SubagentStop/PreCompact — a
below-every-improve-gate direct stash write (no judge/confidence/schema gate)
that floods the stash with write-only telemetry. Meta-review 03-R1/06-M1 retires
it. This is the akm-plugin half; the akm-side recombine exclusion filter is
DEFERRED (load-bearing — it excludes all session-capture memories, not just
checkpoints) and the update-stashes cron is a separate akm PR.

Deleted (claude/hooks/akm-hook.ts): `captureMemory()` + its 3 call sites, the
`capture-memory` CLI subcommand, helpers used only by it, and the now-dead
Stop/SubagentStop/PreCompact hook registrations (their only command was
`capture-memory …`). `akm index` on session-end survives — relocated into
`sessionEnd()` under the same AKM_INDEX_ON_SESSION_END/akmAvailable gates.

PRESERVED (verified by code-review): the memory-CANDIDATE pipeline
(extractCandidatesFromText/appendCandidates/CANDIDATE_LOG → /akm-memory-promote),
the `akm extract` SessionEnd path, and `tagRecalledContent` (the injection-
hardening banner — NOT captureMemory-specific; wraps all recalled/curated
content). Reviewer fixes applied: dropped the now-unused `redactObject` import;
corrected the stale "harvest session memories at stop/compact time" README line.

Tests: removed ~13 captureMemory/session_checkpoint tests; added 3 covering the
relocated sessionEnd→index (runs index, respects opt-out, asserts no `remember`).

Evals: the tier-2 `memory` metric replayed session logs through the now-deleted
`capture-memory session-end`, so it's removed (metric + fixtures + diff policy
rules + docs) and the checked-in baseline regenerated via `baseline:update` (5
metrics, no `memory`). Latency drift in the regen is harmless — latency is
opt-in (`--include-latency`), not gated by default.

Gate: `bun test tests/` 319/0; `tier2/runner.ts --baseline` exit 0 (no regression).

Follow-ups (out of scope): opencode/index.ts has its own parallel
session_checkpoint write (sibling plugin); the recombine filter + live crontab
removal + build/reinstall (~beta.59) remain.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018YjU1mGiShdDP4qFW7p4mv
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Eval diff

  • Baseline SHA: 48f9345a3fc44a7a1f5ff2d4d21f7fd21ae57c61
  • Candidate SHA: 50e6fc8b9cc14708af3feb85d166873ea6a5a26f

Metric deltas

Metric Key Baseline Candidate Δ Δ% Status
curation mean_expected_coverage 0.9125 0.9125 0 0.00% • unchanged
curation mean_reciprocal_rank 0.9208 0.9208 0 0.00% • unchanged
curation zero_hit_rate 0.0500 0.0500 0 0.00% • unchanged
context_budget claude_violations 0 0 0 0.00% • unchanged
context_budget opencode_violations 0 0 0 0.00% • unchanged
context_budget claude_drop_rate 0 0 0 0.00% • unchanged
context_budget opencode_drop_rate 0 0 0 0.00% • unchanged
feedback claude_precision 1 1 0 0.00% • unchanged
feedback claude_recall 1 1 0 0.00% • unchanged
feedback claude_polarity_flips 0 0 0 0.00% • unchanged
feedback opencode_precision 1 1 0 0.00% • unchanged
feedback opencode_recall 1 1 0 0.00% • unchanged
feedback opencode_polarity_flips 0 0 0 0.00% • unchanged

Plugin surface

No surface changes.

No regressions.

@itlackey itlackey merged commit f3f47c8 into release/0.9.0 Jul 5, 2026
2 checks passed
@itlackey itlackey deleted the improve/shutdown-capturememory-write branch July 5, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant